#include <iostream>
using namespace std;

// Student类如下：
class Student {
public:
    void Set_StuNum(int n) { _stu_num = n; }
    void Set_Score(float n) { _score = n; }
    int Get_StudNum() const { return _stu_num; }
    float Get_Score() const { return _score; }
private:
    int _stu_num = 0; //学号
    float _score = 0; //分数   
};

// max函数原型为：
void max(Student*, int, int&, float&); //5个形参的含义分别为：对象指针，学生数，最高分的学生学号，最高分

void max(Student* s, int num, int& stuNum, float& maxScore)
{
    stuNum = s[0].Get_StudNum();
    maxScore = s[0].Get_Score();
    for (int i = 1; i < num; i++)
        if (s[i].Get_Score() > maxScore)
            maxScore = s[i].Get_Score(), stuNum = s[i].Get_StudNum();
}

//要求使用以下main函数测试：
int main() 
{
    int n, stu_num, max_stu_num;
    float score, max_score;
    cin >> n;
    Student* stu = new Student[n];
    for (int i = 0; i < n; i++) 
    {
        cin >> stu_num >> score;
        stu[i].Set_StuNum(stu_num);
        stu[i].Set_Score(score);
    }
    max(stu, n, max_stu_num, max_score);
    cout << max_stu_num << " " << max_score;
    delete[] stu;
    return 0;
}
